package cn.swust.designpatternlearningplatform.controller;

import cn.swust.designpatternlearningplatform.common.AnnotationUtils.Authentication;
import cn.swust.designpatternlearningplatform.common.Result.R;
import cn.swust.designpatternlearningplatform.domain.bo.TrainingTopicBo;
import cn.swust.designpatternlearningplatform.domain.dto.TreeDto;
import cn.swust.designpatternlearningplatform.domain.enums.RoleEnum;
import cn.swust.designpatternlearningplatform.service.SelfTrainingService;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;
import java.util.List;

@RestController
@RequestMapping("/selfTraining")
public class SelfOccupancyTrainingController {

    @Resource
    private SelfTrainingService selfTrainingService;

    /**
     * @return R<Object>
     * @author wang
     * description 获取多级目录
     * date 2023/4/18 19:56
     */
    @RequestMapping("/getAllPoint")
    public R<Object> getAllPoint() {
        TreeDto allPoint = selfTrainingService.getAllPoint();
        return R.success(allPoint);
    }

    /**
     * @param pointId:
     * @return R<Object>
     * @author wang
     * description 通过题目的知识点id把该知识点的所有题目全部返回
     * date 2023/4/20 21:05
     */
    @RequestMapping("/getTopic")
    public R<Object> getTopicByPointId(Integer pointId) {
        List<TrainingTopicBo> list = selfTrainingService.getTopicByPointId(pointId);
        return R.success(list);
    }


}
